// 流光效果
Shader "Custom/Shader_Flow"
{
    Properties
    {
        // Tiling 设置为 12 1
        _Tex("Texture", 2D) = "white"{}
        // 设置为 1ED2FF 天蓝色
        _Color("Color", Color) = (1,1,1,1)

        [KeywordEnum(X,Y)] _DIRECTION("Flow Direction", float) = 0
        // 设置为3
        _Speed("Speed", float) = 1
    }

    SubShader
    {
        Tags {"RendType"="Transparent" "Queue"="Transparent"}
        Blend One One
        Cull Off
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #pragma shader_feature _DIRECTION_X _DIRECTION_Y

            #include "UnityCG.cginc"

            struct v2f{
                float2 texcoord : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            sampler2D _Tex;
            float4 _Tex_ST;
            fixed4 _Color;
            float _Speed;

            v2f vert(appdata_base v){
                v2f o;
                o.texcoord = TRANSFORM_TEX(v.texcoord, _Tex);
                o.vertex = UnityObjectToClipPos(v.vertex);

                return o;

            }

            float4 frag(v2f i):SV_Target{

                float2 texcoord;
                #if _DIRECTION_X
                    texcoord = float2(i.texcoord.x + _Time.x * _Speed, i.texcoord.y);
                #elif _DIRECTION_Y
                    texcoord = float2(i.texcoord.x, i.texcoord.y + _Time.x * _Speed);
                #endif

                return tex2D(_Tex, texcoord) * _Color;
            }
            ENDCG
        }
    }
}